import layoutHeaderAside from '@/layout/header-aside'

// 由于懒加载页面太多的话会造成webpack热更新太慢，所以开发环境不使用懒加载，只有生产环境使用懒加载
const _import = require('@/libs/util.import.' + process.env.NODE_ENV)

const meta = { auth: true }

export default {
  path: '/demo/plugins',
  name: 'demo-plugins',
  meta: { ...meta, title: '插件' },
  redirect: { name: 'demo-plugins-index' },
  component: layoutHeaderAside,
  icon: 'plug',
  children: [
    {
      path: 'index',
      name: 'demo-plugins-index',
      component: _import('demo/plugins/index'),
      meta: { ...meta, title: '插件' },
      icon: 'plug'
    },
    {
      path: 'import',
      name: 'demo-plugins-import',
      component: layoutHeaderAside,
      meta: { ...meta, title: '导入' },
      icon: 'download',
      children: [
        { path: 'csv', name: 'demo-plugins-import-csv', component: _import('demo/plugins/import/csv.vue'), meta: { ...meta, title: '导入 csv' } },
        { path: 'xlsx', name: 'demo-plugins-import-xlsx', component: _import('demo/plugins/import/xlsx.vue'), meta: { ...meta, title: '导入 xlsx' } }
      ]
    },
    {
      path: 'export',
      component: layoutHeaderAside,
      meta: { ...meta, title: '导出' },
      icon: 'upload',
      children: [
        {
          path: 'table',
          name: 'demo-plugins-export-table',
          component: _import('demo/plugins/export/table.vue'),
          meta: { ...meta, title: '导出表格' }
        },
        {
          path: 'txt',
          name: 'demo-plugins-export-txt',
          component: _import('demo/plugins/export/txt.vue'),
          meta: { ...meta, title: '导出文本' }
        }
      ]
    },
    {
      path: 'clipboard-polyfill',
      name: 'demo-plugins-clipboard-polyfill',
      component: _import('demo/plugins/clipboard-polyfill'),
      meta: { ...meta, title: '剪贴板访问' },
      icon: 'clipboard'
    },
    {
      path: 'day',
      name: 'demo-plugins-day',
      component: _import('demo/plugins/day'),
      meta: { ...meta, title: '日期计算' },
      icon: 'clock-o'
    },
    {
      path: 'js-cookie',
      name: 'demo-plugins-js-cookie',
      component: _import('demo/plugins/js-cookie'),
      meta: { ...meta, title: 'Cookie 读写' },
      icon: 'asterisk'
    }
  ]
}
